// $ANTLR 2.7.6 (2005-12-22): "resources/grammars/VSL_Parser.g" -> "VSLParser.java"$

package com.cea.papyrus.classdiagram.parsers.antlr;

import com.cea.papyrus.classdiagram.parsers.texteditor.vsldatatypes.IContext;

import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;
import antlr.collections.AST;
import java.util.Hashtable;
import antlr.ASTFactory;
import antlr.ASTPair;
import antlr.collections.impl.ASTArray;

public class VSLParser extends antlr.LLkParser       implements VSLTokenTypes
 {

	private int context = -1;
	
	/**
	 * Validation state (true = validation : does not modify the property
	 */
	private boolean isValidation = false;
	
	
	private static final boolean DEBUG = false;
	/**
	 * @return the isValidation boolean
	 */
	public boolean isValidation() {
		return isValidation;
	}

	/**
	 * @param isValidation the isValidation to set (true -> do not modify the property)
	 */
	public void setValidation(boolean isValidation) {
		this.isValidation = isValidation;
	}
	
	
	public int getContext() {
		return context;
	}
	
	public void setContext(int context) {
		this.context = context;
	}
	
	 /** debug mode */
    protected final boolean debugMode = false;  	
    	
    /**
     * Debug method (~System.out.println)
     */
    private void debug(Object debug) {
    	if(debugMode) {
    		System.out.println(debug);	
    	}	
    }
	
	 /**
     * Error method (~System.err.println)
     */
    private void error(Object debug) {
    	if(debugMode) {
    		System.err.println(debug);	
    	}	
    }
	
/*	public VSLParser(TokenStream lexer, Vector names) {
		this(lexer);
		this.names = names;
	}
	
	private Vector names;*/

protected VSLParser(TokenBuffer tokenBuf, int k) {
  super(tokenBuf,k);
  tokenNames = _tokenNames;
  buildTokenTypeASTClassMap();
  astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}

public VSLParser(TokenBuffer tokenBuf) {
  this(tokenBuf,4);
}

protected VSLParser(TokenStream lexer, int k) {
  super(lexer,k);
  tokenNames = _tokenNames;
  buildTokenTypeASTClassMap();
  astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}

public VSLParser(TokenStream lexer) {
  this(lexer,4);
}

public VSLParser(ParserSharedInputState state) {
  super(state,4);
  tokenNames = _tokenNames;
  buildTokenTypeASTClassMap();
  astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}

	public final void nfpValueSpecification() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST nfpValueSpecification_AST = null;
		
		
				context = IContext.NFP_VALUE_SPECIFICATION;
			
		{
		switch ( LA(1)) {
		case STAR:
		case DECIMAL_STRING:
		case BINARY_STRING:
		case HEXADECIMAL_STRING:
		case IDENT:
		case PLUS:
		case MINUS:
		case TRUE:
		case FALSE:
		case NULL:
		case STRING_TEXT:
		case 38:
		{
			literal();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case LPAREN:
		{
			tuple();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		nfpValueSpecification_AST = (AST)currentAST.root;
		returnAST = nfpValueSpecification_AST;
	}
	
	public final void literal() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST literal_AST = null;
		
		
				context = IContext.LITERAL;
			
		{
		switch ( LA(1)) {
		case STAR:
		case DECIMAL_STRING:
		case BINARY_STRING:
		case HEXADECIMAL_STRING:
		case PLUS:
		case MINUS:
		{
			numberLiteral();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case STRING_TEXT:
		{
			stringLiteral();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case TRUE:
		case FALSE:
		{
			booleanLiteral();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case NULL:
		{
			nullLiteral();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case 38:
		{
			defaultLiteral();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case IDENT:
		{
			enumerationSpecification();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		literal_AST = (AST)currentAST.root;
		returnAST = literal_AST;
	}
	
	public final void tuple() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST tuple_AST = null;
		
		
				context = IContext.TUPLE;
			
		{
		AST tmp1_AST = null;
		tmp1_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp1_AST);
		match(LPAREN);
		tupleItem();
		astFactory.addASTChild(currentAST, returnAST);
		{
		_loop34:
		do {
			if ((LA(1)==COMMA)) {
				AST tmp2_AST = null;
				tmp2_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp2_AST);
				match(COMMA);
				tupleItem();
				astFactory.addASTChild(currentAST, returnAST);
			}
			else {
				break _loop34;
			}
			
		} while (true);
		}
		AST tmp3_AST = null;
		tmp3_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp3_AST);
		match(RPAREN);
		}
		tuple_AST = (AST)currentAST.root;
		returnAST = tuple_AST;
	}
	
	public final void numberLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST numberLiteral_AST = null;
		
		
				context = IContext.NUMBER_LITERAL;
			
		{
		if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (_tokenSet_3.member(LA(4)))) {
			{
			if ((_tokenSet_0.member(LA(1))) && (_tokenSet_4.member(LA(2)))) {
				{
				switch ( LA(1)) {
				case PLUS:
				{
					AST tmp4_AST = null;
					tmp4_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp4_AST);
					match(PLUS);
					break;
				}
				case MINUS:
				{
					AST tmp5_AST = null;
					tmp5_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp5_AST);
					match(MINUS);
					break;
				}
				case DECIMAL_STRING:
				case BINARY_STRING:
				case HEXADECIMAL_STRING:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				integerLiteral();
				astFactory.addASTChild(currentAST, returnAST);
			}
			else if ((LA(1)==DECIMAL_STRING) && (LA(2)==DOT)) {
				realLiteral();
				astFactory.addASTChild(currentAST, returnAST);
			}
			else {
				throw new NoViableAltException(LT(1), getFilename());
			}
			
			}
		}
		else if ((_tokenSet_5.member(LA(1))) && (LA(2)==EOF||LA(2)==COMMA||LA(2)==RPAREN) && (_tokenSet_6.member(LA(3))) && (_tokenSet_7.member(LA(4)))) {
			unlimitedLiteral();
			astFactory.addASTChild(currentAST, returnAST);
		}
		else {
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		}
		numberLiteral_AST = (AST)currentAST.root;
		returnAST = numberLiteral_AST;
	}
	
	public final void stringLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST stringLiteral_AST = null;
		
		
				context = IContext.STRING_LITERAL;
			
		{
		AST tmp6_AST = null;
		tmp6_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp6_AST);
		match(STRING_TEXT);
		}
		stringLiteral_AST = (AST)currentAST.root;
		returnAST = stringLiteral_AST;
	}
	
	public final void booleanLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST booleanLiteral_AST = null;
		
		
				context = IContext.BOOLEAN_LITERAL;
			
		{
		switch ( LA(1)) {
		case TRUE:
		{
			AST tmp7_AST = null;
			tmp7_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp7_AST);
			match(TRUE);
			break;
		}
		case FALSE:
		{
			AST tmp8_AST = null;
			tmp8_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp8_AST);
			match(FALSE);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		booleanLiteral_AST = (AST)currentAST.root;
		returnAST = booleanLiteral_AST;
	}
	
	public final void nullLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST nullLiteral_AST = null;
		
		
				context = IContext.NULL_LITERAL;
			
		{
		AST tmp9_AST = null;
		tmp9_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp9_AST);
		match(NULL);
		}
		nullLiteral_AST = (AST)currentAST.root;
		returnAST = nullLiteral_AST;
	}
	
	public final void defaultLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST defaultLiteral_AST = null;
		
		
				context = IContext.DEFAULT_LITERAL;
			
		{
		AST tmp10_AST = null;
		tmp10_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp10_AST);
		match(38);
		}
		defaultLiteral_AST = (AST)currentAST.root;
		returnAST = defaultLiteral_AST;
	}
	
	public final void enumerationSpecification() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST enumerationSpecification_AST = null;
		
		
				context = IContext.ENUMERATION;
			
		{
		AST tmp11_AST = null;
		tmp11_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp11_AST);
		match(IDENT);
		}
		enumerationSpecification_AST = (AST)currentAST.root;
		returnAST = enumerationSpecification_AST;
	}
	
	public final void integerLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST integerLiteral_AST = null;
		
		
				context = IContext.INTEGER_LITERAL;
			
		{
		{
		switch ( LA(1)) {
		case DECIMAL_STRING:
		{
			AST tmp12_AST = null;
			tmp12_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp12_AST);
			match(DECIMAL_STRING);
			break;
		}
		case HEXADECIMAL_STRING:
		{
			AST tmp13_AST = null;
			tmp13_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp13_AST);
			match(HEXADECIMAL_STRING);
			break;
		}
		case BINARY_STRING:
		{
			AST tmp14_AST = null;
			tmp14_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp14_AST);
			match(BINARY_STRING);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		}
		integerLiteral_AST = (AST)currentAST.root;
		returnAST = integerLiteral_AST;
	}
	
	public final void realLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST realLiteral_AST = null;
		
		
				context = IContext.REAL_LITERAL;
			
		{
		{
		if ((LA(1)==DECIMAL_STRING) && (LA(2)==DOT) && (LA(3)==DECIMAL_STRING) && (LA(4)==EOF||LA(4)==COMMA||LA(4)==RPAREN)) {
			AST tmp15_AST = null;
			tmp15_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp15_AST);
			match(DECIMAL_STRING);
			AST tmp16_AST = null;
			tmp16_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp16_AST);
			match(DOT);
			AST tmp17_AST = null;
			tmp17_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp17_AST);
			match(DECIMAL_STRING);
		}
		else if ((LA(1)==DECIMAL_STRING) && (LA(2)==DOT) && (LA(3)==DECIMAL_STRING) && (LA(4)==EXPONENT)) {
			scientificReal();
			astFactory.addASTChild(currentAST, returnAST);
		}
		else {
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		}
		}
		realLiteral_AST = (AST)currentAST.root;
		returnAST = realLiteral_AST;
	}
	
	public final void unlimitedLiteral() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST unlimitedLiteral_AST = null;
		
		
				context = IContext.UNLIMITED_LITERAL;
			
		{
		switch ( LA(1)) {
		case STAR:
		{
			AST tmp18_AST = null;
			tmp18_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp18_AST);
			match(STAR);
			break;
		}
		case DECIMAL_STRING:
		case BINARY_STRING:
		case HEXADECIMAL_STRING:
		{
			integerLiteral();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		unlimitedLiteral_AST = (AST)currentAST.root;
		returnAST = unlimitedLiteral_AST;
	}
	
	public final void scientificReal() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST scientificReal_AST = null;
		
		
				context = IContext.SCIENTIFIC_REAL;
			
		{
		{
		AST tmp19_AST = null;
		tmp19_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp19_AST);
		match(DECIMAL_STRING);
		AST tmp20_AST = null;
		tmp20_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp20_AST);
		match(DOT);
		AST tmp21_AST = null;
		tmp21_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp21_AST);
		match(DECIMAL_STRING);
		}
		AST tmp22_AST = null;
		tmp22_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp22_AST);
		match(EXPONENT);
		{
		switch ( LA(1)) {
		case PLUS:
		{
			AST tmp23_AST = null;
			tmp23_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp23_AST);
			match(PLUS);
			break;
		}
		case MINUS:
		{
			AST tmp24_AST = null;
			tmp24_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp24_AST);
			match(MINUS);
			break;
		}
		case DECIMAL_STRING:
		{
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		AST tmp25_AST = null;
		tmp25_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp25_AST);
		match(DECIMAL_STRING);
		}
		scientificReal_AST = (AST)currentAST.root;
		returnAST = scientificReal_AST;
	}
	
	public final void tupleItem() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST tupleItem_AST = null;
		Token  id = null;
		AST id_AST = null;
		
		
				context = IContext.TUPLEITEM;
			
		{
		{
		id = LT(1);
		id_AST = astFactory.create(id);
		astFactory.addASTChild(currentAST, id_AST);
		match(IDENT);
		AST tmp26_AST = null;
		tmp26_AST = astFactory.create(LT(1));
		astFactory.addASTChild(currentAST, tmp26_AST);
		match(ASSIGN);
		}
		{
		switch ( LA(1)) {
		case STAR:
		case DECIMAL_STRING:
		case BINARY_STRING:
		case HEXADECIMAL_STRING:
		case IDENT:
		case PLUS:
		case MINUS:
		case TRUE:
		case FALSE:
		case NULL:
		case STRING_TEXT:
		case 38:
		{
			literal();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		case LPAREN:
		{
			tuple();
			astFactory.addASTChild(currentAST, returnAST);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		}
		tupleItem_AST = (AST)currentAST.root;
		returnAST = tupleItem_AST;
	}
	
	public final void epsilon() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST epsilon_AST = null;
		
		
				System.out.println("EPSILON");
			
		epsilon_AST = (AST)currentAST.root;
		returnAST = epsilon_AST;
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"MOD",
		"DOT",
		"DOTDOT",
		"LBRACK",
		"RBRACK",
		"LCURLY",
		"RCURLY",
		"COMMA",
		"COLON",
		"STAR",
		"EXPONENT",
		"DECIMAL_STRING",
		"BINARY_STRING",
		"HEXADECIMAL_STRING",
		"QUOTE",
		"DAY",
		"RPAREN",
		"LPAREN",
		"ASSIGN",
		"IDENT",
		"SHARP",
		"PLUS",
		"MINUS",
		"LE",
		"LT",
		"GE",
		"GT",
		"EQUAL",
		"DIFF",
		"DIV",
		"TRUE",
		"FALSE",
		"NULL",
		"STRING_TEXT",
		"\"-\""
	};
	
	protected void buildTokenTypeASTClassMap() {
		tokenTypeToASTClassMap=null;
	};
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { 100892672L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	private static final long[] mk_tokenSet_1() {
		long[] data = { 1280034L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
	private static final long[] mk_tokenSet_2() {
		long[] data = { 9472002L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
	private static final long[] mk_tokenSet_3() {
		long[] data = { 13649922L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
	private static final long[] mk_tokenSet_4() {
		long[] data = { 1280002L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
	private static final long[] mk_tokenSet_5() {
		long[] data = { 237568L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
	private static final long[] mk_tokenSet_6() {
		long[] data = { 9439234L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
	private static final long[] mk_tokenSet_7() {
		long[] data = { 13633538L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
	
	}
